package com.example.shop.model;

/**
 * author: adnaan
 * create: 2023-11-07 13:53
 * Description:
 */
public class ApiResponse {

    private String code;
    private String msg;
    private Object data;

    public ApiResponse(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }


    public static ApiResponse success(String code, String msg) {
        return new ApiResponse(code, msg, null);
    }

    public static ApiResponse success(String code, String msg,Object data) {
        return new ApiResponse(code, msg, data);
    }

    public static ApiResponse error(String code, String msg) {
        return new ApiResponse(code, msg, null);
    }

    public static ApiResponse error() {
        return new ApiResponse("500", "系统错误", null);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
